package fr.greta.centreFormation.controller;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.swing.JOptionPane;

/**
 * Servlet implementation class VerifContact
 */
public class VerifContact extends HttpServlet {
	private static final long serialVersionUID = 1L;
	ArrayList<Contact>tab;
	
	public void init(javax.servlet.ServletConfig config) throws ServletException {
		tab = new ArrayList<Contact>();
	}
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession(true);
		
		String nom = request.getParameter("Lenom");
		String mail = request.getParameter("mail");
		String sujet =request.getParameter("sujet") ;
		String texte =request.getParameter("texte") ; 
				


		
		
		if ((mail.equals ("")) || (texte.equals(""))){
			JOptionPane.showMessageDialog(null, "Veuillez renseigner mail et message svp!", "Veuillez renseigner mail et message svp!", JOptionPane.ERROR_MESSAGE);

			

			request.getRequestDispatcher("contact.jsp").forward(request, response);
		}else{


			
			
		request.getRequestDispatcher("validation.html").forward(request, response);}
	
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
